<!--{template header}-->

<!--{if $op == 'syn' || $op == 'find' || $op == 'group' || $op == 'groupname' || $op == 'request'}-->

<!--{if $_SGLOBAL['guidemode']}-->
<!--{template space_guide}-->
<!--{else}-->
<div class="c_header a_header">
	<a href="space.php?uid=$space[uid]"><img src="<!--{avatar($space[uid],small)}-->" alt="$space[username]" class="avatar" /></a>
	<h1>好友</h1>
	<a href="space.php?uid=$space[uid]" class="spacelink">我的空间</a>
</div>

<div class="tabs_header">
	<ul class="tabs">
		<li$actives[groupname]><a href="space.php?uid=$space[uid]&do=friend">好友列表</a></li>
		<li><a href="space.php?uid=$space[uid]&do=friend&view=visitor">我的访客</a></li>
		<li><a href="space.php?uid=$space[uid]&do=friend&view=trace">我的足迹</a></li>
		<li><a href="space.php?uid=$space[uid]&do=friend&view=online">在线用户</a></li>
		<li$actives[find]><a href="cp.php?ac=friend&op=find">寻找好友</a></li>
		<!--{if empty($_SCONFIG['closeinvite'])}-->
		<li$actives[invite]><a href="cp.php?ac=invite">邀请好友</a></li>
		<!--{/if}-->
		<!--{if $op=='request'}--><li$actives[request]><a href="cp.php?ac=friend&op=request">好友请求</a></li><!--{/if}-->
	</ul>
</div>
<!--{/if}-->
<!--{/if}-->

<!--{if $op == 'group' || $op == 'groupname'}-->
<div class="h_status">
	<table width="100%">
	<tr>
		<td>
			分组操作：<a href="cp.php?ac=friend&op=groupname">设置好友分组名</a>
			<span class="pipe">|</span>
			<a href="cp.php?ac=friend&op=group">好友批量分组</a>
		</td>
		<td align="right">
		<!--{if $_GET['op']=='group'}-->
		<select name="friend_group" onchange="location.href='cp.php?ac=friend&op=group&group='+this.value">
		<option value="-1">全部好友($space[friendnum])</option>
		<!--{loop $groups $key $value}-->
		<option value="$key"$groupselect[$key]>$value</option>
		<!--{/loop}-->
		</select>
		<!--{/if}-->
		</td>
	</tr>
	</table>
</div>
<!--{/if}-->

<!--{if $op=='ignore'}-->

<div id="$uid" <!--{if !$_SGLOBAL[inajax]}-->class="inpage"<!--{/if}-->>
<form method="post" id="friendform" name="friendform" action="cp.php?ac=friend&op=ignore&uid=$uid&confirm=1">
	<h1>确定忽略好友关系吗？</h1>
	<p class="btn_line">
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]">
		<!--{if $_SGLOBAL[inajax]}-->
		<input type="hidden" name="friendsubmit" value="true" />
		<button name="friendsubmit_btn" type="button" class="submit" value="true" onclick="ajaxpost('friendform', '$uid', 'friend_delete')">确定</button>
		<button name="btncancel" type="button" class="button" onclick="hideMenu()">取消</button>
		<!--{else}-->
		<button name="friendsubmit" type="submit" class="submit" value="true">确定</button>
		<!--{/if}-->
	</p>
</form>
</div>

<!--{elseif $op == 'find'}-->
<div class="c_form">
		<table cellspacing="0" cellpadding="0" class="formtable">
		<caption>
			<h2>帮您找好友</h2>
			<p>这是一个好友网络，有了好友，您就可以随时关注好友的更新动态，并与好友一起分享你信息。<br>系统自动为您找到了以下好友，供您参考 (点击用户名可以申请加好友)</p>
		</caption>
		
		<!--{if $friendlist}-->
		<tr><td style="font-weight:bold;">您的好友的好友：</td></tr>
		<tr>
			<td>
			<ul class="avatar_list">
				<!--{loop $friendlist $key $value}-->
				<li>
					<a href="space.php?uid=$value[uid]" title="$value[username]" target="_blank"><img src="<!--{avatar($value[uid],small)}-->" alt="$value[username]" class="avatar" /></a>
					<p><a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_friend_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)" title="加为好友" class="addfriend">&nbsp;</a> <a href="space.php?uid=$value[uid]" target="_blank">$value[username]</a></p>
				</li>
				<!--{/loop}-->
			</ul>
			</td>
		</tr>
		<!--{/if}-->
		
		<!--{if $residelist}-->
		<tr><td style="font-weight:bold;">居住在 $space[resideprovince] $space[residecity] 好友推荐：</td></tr>
		<tr>
			<td>
			<ul class="avatar_list">
				<!--{loop $residelist $key $value}-->
				<li>
					<a href="space.php?uid=$value[uid]" title="$value[username]" target="_blank"><img src="<!--{avatar($value[uid],small)}-->" alt="$value[username]" class="avatar" /></a>
					<p><a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_reside_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)" title="加为好友" class="addfriend">&nbsp;</a> <a href="space.php?uid=$value[uid]" target="_blank">$value[username]</a></p>
				</li>
				<!--{/loop}-->
			</ul>
			</td>
		</tr>
		<!--{/if}-->
		
		
		<!--{if $sexlist}-->
		<tr><td style="font-weight:bold;">
		<!--{if empty($space['marry']) || $space['marry'] < 2}-->单身<!--{/if}-->
		<!--{if empty($space['sex']) || $space['sex'] < 2}-->女性<!--{else}-->男性<!--{/if}--> 好友推荐：
		</td></tr>
		<tr>
			<td>
			<ul class="avatar_list">
				<!--{loop $sexlist $key $value}-->
				<li>
					<a href="space.php?uid=$value[uid]" title="$value[username]" target="_blank"><img src="<!--{avatar($value[uid],small)}-->" alt="$value[username]" class="avatar" /></a>
					<p><a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_sex_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)" title="加为好友" class="addfriend">&nbsp;</a> <a href="space.php?uid=$value[uid]" target="_blank">$value[username]</a></p>
				</li>
				<!--{/loop}-->
			</ul>
			</td>
		</tr>
		<!--{/if}-->
		
		<!--{if $hotlist}-->
		<tr><td style="font-weight:bold;">人气最高的好友推荐：</td></tr>
		<tr>
			<td>
			<ul class="avatar_list">
				<!--{loop $hotlist $key $value}-->
				<li>
					<a href="space.php?uid=$value[uid]" title="$value[username]" target="_blank"><img src="<!--{avatar($value[uid],small)}-->" alt="$value[username]" class="avatar" /></a>
					<p><a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_hot_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)" title="加为好友" class="addfriend">&nbsp;</a> <a href="space.php?uid=$value[uid]" target="_blank">$value[username]</a></p>
				</li>
				<!--{/loop}-->
			</ul>
			</td>
		</tr>
		<!--{/if}-->
		
		</table>
</div>

<form method="get" action="network.php" class="c_form"<!--{if $_SGLOBAL['guidemode']}--> target="_blank"<!--{/if}-->>
	<table cellspacing="0" cellpadding="0" class="formtable">
		<caption>
			<h2>自己找好友</h2>
			<p>您可以自己设置搜索条件，寻找与自己志同道合的好友</p>
		</caption>
		<tr>
			<th>用户名</th>
			<td>
				<input type="text" class="t_input" name="username" value="" />
			</td>
		</tr>
		<tr>
			<th>名字(昵称)</th>
			<td>
				<input type="text" class="t_input" name="spacename" value="" />
			</td>
		</tr>
		<tr>
			<th>性别</th>
			<td>
				<select id="sex" name="sex">
					<option value="0">无</option>
					<option value="1"$sexarr[1]>男</option>
					<option value="2"$sexarr[2]>女</option>
				</select>
			</td>
		</tr>
		<tr>
			<th>生日</th>
			<td>
				<select id="birthyear" name="birthyear">
					<option value="0">年</option>
					$birthyeayhtml
				</select> 
				<select id="birthmonth" name="birthmonth">
					<option value="0">月</option>
					$birthmonthhtml
				</select> 
				<select id="birthday" name="birthday">
					<option value="0">日</option>
					$birthdayhtml
				</select> 
			</td>
		</tr>
		
		<tr>
			<th>血型</th>
			<td>
				<select id="blood" name="blood">
					<option value="">无</option>
					$bloodhtml
				</select>
			</td>
		</tr>
		<tr>
			<th>婚恋</th>
			<td>
				<select id="marry" name="marry">
					<option value="0">无</option>
					<option value="1"$marryarr[1]>单身</option>
					<option value="2"$marryarr[2]>非单身</option>
				</select>
			</td>
		</tr>
		
		<tr>
			<th>出生地</th>
			<td>
				<script type="text/javascript" src="source/script_city.js"></script>
				<script type="text/javascript">
				<!--
				showprovince('birthprovince', 'birthcity', '');
				showcity('birthcity', '');
				//-->
				</script>
			</td>
		</tr>
		<tr>
			<th>居住地</th>
			<td>
				<script type="text/javascript">
				<!--
				showprovince('resideprovince', 'residecity', '');
				showcity('residecity', '');
				//-->
				</script>
			</td>
		</tr>
		<tr>
			<th>QQ</th>
			<td>
				<input type="text" name="qq" value="" class="t_input" />
			</td>
		</tr>
		<tr>
			<th>MSN</th>
			<td>
				<input type="text" name="msn" value="" class="t_input" />
			</td>
		</tr>
		<tr>
			<th>选吧</th>
			<td colspan="3">
			<select name="fieldid">
				<option value="0">请选择</option>
				<!--{loop $_SGLOBAL[profield] $fieldid $value}-->
				<option value="$fieldid"$fieldids[$fieldid]>$value[title]</option>
				<!--{/loop}-->
			</select>
			<input type="text" class="t_input" name="fieldname" value="" />
			</td>
		</tr>
		
		<!--{loop $fields $fkey $fvalue}-->
		<!--{if $fvalue[allowsearch]}-->
		<tr>
			<th>$fvalue[title]</th>
			<td>
				$fvalue[html]
			</td>
		</tr>
		<!--{/if}-->
		<!--{/loop}-->

		<!--{if $_SGLOBAL['guidemode']}-->
		</table>
		<table cellspacing="0" cellpadding="0" class="formtable">
		<tr>
			<th width="23%">&nbsp;</th>
			<td>
			<input type="hidden" name="guidemode" value="1">
			<input type="hidden" name="ac" value="space" />
			<input type="hidden" name="searchmode" value="1" />
			<input type="submit" name="findsubmit" value="寻找好友" class="submit" />
			</td>
		</tr>
		</table>
		
		<table cellspacing="0" cellpadding="0" class="formtable">
		<caption>
			<h2>安家完成</h2>
			<p>您可以点击下面的按钮，结束安家过程</p>
		</caption>
		<tr>
			<th width="23%">&nbsp;</th>
			<td>
				<input type="button" name="closeguide" value="结束向导" class="submit" onclick="window.location='space.php?do=home&view=guide&step=4';" />
				<br>结束向导后，您还可以在导航菜单中重新找到向导入口
			</td>
		</tr>
		<!--{else}-->
		<tr>
			<th>&nbsp;</th>
			<td>
			<input type="hidden" name="ac" value="space" />
			<input type="hidden" name="searchmode" value="1" />
			<input type="submit" name="findsubmit" value="寻找好友" class="submit" />
			</td>
		</tr>
		<!--{/if}-->
	</table>
</form>

<!--{elseif $op=='changegroup'}-->

<div id="$uid" <!--{if !$_SGLOBAL[inajax]}-->class="inpage"<!--{/if}-->>
<form method="post" id="friendform" name="friendform" action="cp.php?ac=friend&op=changegroup&uid=$uid">
	设置新分组: 
	<select name="group">
	<!--{loop $groups $key $value}-->
	<option value="$key"$groupselect[$key]>$value</option>
	<!--{/loop}-->
	</select>

	<p class="btn_line">
		<input type="hidden" name="refer" value="$_SGLOBAL[refer]">
		<!--{if $_SGLOBAL[inajax]}-->
		<input type="hidden" name="changegroupsubmit" value="true" />
		<button name="changegroupsubmit_btn" type="button" class="submit" value="true" onclick="ajaxpost('friendform', '$uid', 'friend_changegroup')">确定</button>&nbsp;
		<button name="btncancel" type="button" class="button" onclick="hideMenu()">取消</button>
		<!--{else}-->
		<button name="changegroupsubmit" type="submit" class="submit" value="true">确定</button>
		<!--{/if}-->
	</p>
</form>
</div>

<!--{elseif $op=='group'}-->

<form method="post" action="cp.php?ac=friend&op=group&ref" class="c_form">
	<table cellspacing="0" cellpadding="0" class="formtable linetable">
		<caption>
			<h2>好友批量分组</h2>
			<p>您可以对好友列表进行批量分组管理</p>
		</caption>
		<!--{loop $list $value}-->
		<tr>
			<td width="25"><input type="checkbox" name="fuids[]" value="$value[uid]" /></td>
			<td width="40"><a href="space.php?uid=$value[uid]"><img src="<!--{avatar($value[uid],small)}-->" alt="$value[username]" width="30" height="30" /></a></td>
			<td><a href="space.php?uid=$value[uid]">$value[username]</a></td>
			<td style="text-align: right;">$value[group]</td>
		</tr>
		<!--{/loop}-->
		<tr>
			<td width="25"><input type="checkbox" id="chkall" name="chkall" onclick="checkAll(this.form, 'fuids')" /></td>
			<td width="40"><label for="chkall">全选</label></td>
			<td>
			设置用户组：<select name="group">
			<!--{loop $groups $key $value}-->
				<option value="$key">$value</option>
			<!--{/loop}-->
			</select>
			<input type="hidden" name="groupsubmin" value="true" />
			<input type="submit" name="btnsubmit" value="确定" class="submit" />
			</td>
			<td>&nbsp;</td>
		</tr>
	</table>
	<br>
	<div class="page">$multi[html]</div>
</form>

<!--{elseif $op=='groupname'}-->

<form method="post" action="cp.php?ac=friend&op=groupname&ref" class="c_form">
	<table cellspacing="0" cellpadding="0" class="formtable">
		<caption>
			<h2>设置好友分组名</h2>
			<p>自定义好友用户组名。</p>
		</caption>
		<!--{loop $groups $key $value}-->
		<tr>
			<td><input type="text" name="privacy[groupname][$key]" value="$value" size="15" class="t_input"<!--{if $key==0}--> disabled<!--{/if}--> /></td>
		</tr>
		<!--{/loop}-->
		<tr>
			<td>
			<input type="submit" name="groupnamesubmit" value="保存设置" class="submit"></td>
		</tr>
	</table>
	
	<table cellspacing="0" cellpadding="0" class="formtable">
		<caption>
			<h2>好友批量分组</h2>
			<p>对当前的好友进行批量分组。</p>
		</caption>
		<tr>
			<td><a href="cp.php?ac=friend&op=group">点击进入操作页面</a></td>
		</tr>
	</table>
	
	<table cellspacing="0" cellpadding="0" class="formtable">
		<caption>
			<h2>屏蔽指定好友组的动态</h2>
			<p>可以将指定好友组内的好友的动态全部屏蔽掉。</p>
		</caption>
		<tr>
			<td><a href="cp.php?ac=privacy&op=view">点击进入操作页面</a></td>
		</tr>
	</table>
	
</form>
	
<!--{elseif $op=='request'}-->

<form method="post" action="cp.php?ac=friend&op=request&ref" class="c_form">
	<table cellspacing="0" cellpadding="0" class="formtable linetable" width="100%">
		<caption>
			<h2>好友请求</h2>
			<p>您可以对好友的请求进行批准或者拒绝操作</p>
		</caption>
		<!--{if $list}-->
		<!--{loop $list $value}-->
		<tbody id="friend_$value[uid]">
		<tr>
			<td width="40"><a href="space.php?uid=$value[uid]" target="_blank"><img src="<!--{avatar($value[uid],small)}-->" alt="$value[username]" width="30" height="30" /></a></td>
			<td width="80"><a href="space.php?uid=$value[uid]">$value[username]</a></td>
			<td>$value[note] &nbsp;</td>
			<td style="text-align: right;">
				<a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_f_r_$value[uid]" onclick="ajaxmenu(event, this.id, 99999, '', -1)">批准</a><span class="pipe">|</span>
				<a href="cp.php?ac=friend&op=ignore&uid=$value[uid]&confirm=1" id="a_f_i_$value[uid]" onclick="ajaxmenu(event, this.id, 1, 'myfriend')">拒绝</a>
			</td>
		</tr>
		</tbody>
		<!--{/loop}-->
		<!--{else}-->
		<tr><td width="400">还没有好友请求。</td></tr>
		<!--{/if}-->
	</table>
</form>

<script>
	function myfriend(id) {
		var liid = id.substr(6);
		$('friend_'+liid).style.display = "none";
	}
</script>

<!--{elseif $op=='add'}-->

<div id="$tospace[uid]" <!--{if !$_SGLOBAL[inajax]}-->class="inpage"<!--{/if}-->>
<!--{if $_SGLOBAL[inajax]}-->
<h1>加好友</h1>
<a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>
<div class="popupmenu_inner">
<!--{/if}-->
<form method="post" id="addform" name="addform" action="cp.php?ac=friend&op=add&uid=$tospace[uid]">
	<table cellspacing="0" cellpadding="3">
		<tr>
			<th width="52"><a href="space.php?uid=$tospace[uid]"><img src="<!--{avatar($tospace[uid],small)}-->" alt="$tospace[username]" width="48" height="48" /></th>
			<td>加 <strong>$tospace[username]</strong> 为好友，附言：<br />
				<input type="text" name="note" value="" size="20" class="t_input" style="width: 300px;"  onkeydown="ctrlEnter(event, 'addsubmit_btn', 1);" />
				<p class="gray">(附言为可选，$tospace[username] 会看到这条附言，最多50个字符)</p>
			</td>
		</tr>
		<tr>
			<th>&nbsp;</th>
			<td>
				分组: <select name="gid">
				<!--{loop $groups $key $value}-->
				<option value="$key">$value</option>
				<!--{/loop}-->
				</select>
				<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
				<input type="hidden" name="addsubmit" value="true" />
				<!--{if $_SGLOBAL[inajax]}-->
				<input type="button" name="addsubmit_btn" id="addsubmit_btn" value="确定" class="submit" onclick="ajaxpost('addform', '$tospace[uid]')" />
				<!--{else}-->
				<input type="submit" name="addsubmit_btn" id="addsubmit_btn" value="确定" class="submit" />
				<!--{/if}-->
			</td>
	</table>
</form>
<!--{if $_SGLOBAL[inajax]}--></div><!--{/if}-->
</div>


<!--{elseif $op=='add2'}-->

<div id="$tospace[uid]" <!--{if !$_SGLOBAL[inajax]}-->class="inpage"<!--{/if}-->>
<!--{if $_SGLOBAL[inajax]}-->
<h1>批准请求</h1>
<a href="javascript:hideMenu();" title="关闭" class="float_del">关闭</a>
<div class="popupmenu_inner" style="width: 400px;">
<!--{/if}-->
<form method="post" id="addform" name="addform" action="cp.php?ac=friend&op=add&uid=$tospace[uid]">
	<table cellspacing="0" cellpadding="3">
		<tr>
			<th width="52"><a href="space.php?uid=$tospace[uid]"><img src="<!--{avatar($tospace[uid],small)}-->" alt="$tospace[username]" width="48" height="48" /></th>
			<td>批准 <strong>$tospace[username]</strong> 的好友请求，并分组：<br>
				<select name="gid">
				<!--{loop $groups $key $value}-->
				<option value="$key">$value</option>
				<!--{/loop}-->
				</select>
				<input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
				<!--{if $_SGLOBAL[inajax]}-->
				<input type="hidden" name="add2submit" value="true" />
				<input type="button" name="add2submit_btn" value="批准" class="submit" onclick="ajaxpost('addform', '$tospace[uid]', 'myfriend_post')" />
				<!--{else}-->
				<input type="submit" name="add2submit" value="批准" class="submit" />
				<!--{/if}-->
			</td>
	</table>
</form>
<!--{if $_SGLOBAL[inajax]}--></div><!--{/if}-->
</div>

<!--{/if}-->
<!--{template footer}-->